package com.vitaf.cash.app.utils.shared

/**
 * SharedHelper
 * @Author wwdeng
 * @CreateTime: 2024/11/8 10:59
 * @Annotation：SharedPreferences 数据存取帮助类
 */
object VitafSharedHp {

    /**
     * 保存数据
     */
    fun addGombeCreditSharedData(key: String, value: Any){
        VitafSharedUtils.put(key,value)
    }

    /**
     * 获取String
     */
    fun takeGombeCreditSharedString(key: String): String{
        return VitafSharedUtils.getString(key)
    }

    /**
     * 获取boolean
     */
    fun takeGombeCreditSharedBoolean(key: String): Boolean{
        return VitafSharedUtils.getBoolean(key,false)
    }

    /**
     * 获取Int
     */
    fun takeGombeCreditSharedInt(key: String): Int{
        return VitafSharedUtils.getInt(key,0)
    }


    /**
     * 移除指定内容
     */
    fun deleteGombeCreditSharedData(key: String){
        VitafSharedUtils.remove(key)
    }

    /**
     * 退出登录，移除用户信息
     */
    fun onGombeCreditLoginOut(){
        //移除已登录状态
        deleteGombeCreditSharedData(VitafSharedKey.GOMBECREDIT_LOGIN)
        //移除用户Token
        deleteGombeCreditSharedData(VitafSharedKey.GOMBECREDIT_TOKEN)
        //移除用户id
        deleteGombeCreditSharedData(VitafSharedKey.GOMBECREDIT_USERID)
        deleteGombeCreditSharedData(VitafSharedKey.GOMBECREDIT_MOBILE)
        deleteGombeCreditSharedData(VitafSharedKey.GOMBECREDIT_IS_ADSOURCE)
        deleteGombeCreditSharedData(VitafSharedKey.GOMBECREDIT_PROCESS)
        deleteGombeCreditSharedData(VitafSharedKey.GOMBECREDIT_CUSTOM_DATA)
        deleteGombeCreditSharedData(VitafSharedKey.GOMBECREDIT_CHAT_LAST_TIME)
        deleteGombeCreditSharedData(VitafSharedKey.GOMBECREDIT_UPDATE_VERSION_LAST_TIME)
//        deleteGombeCreditSharedData(GombeCreditSharedKey.GOMBECREDIT_PERMISSIONS_STATUS)

    }
}